# Contributor: Timo Teräs <timo.teras@iki.fi>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=aaudit
pkgver=0.7.2
pkgrel=3
pkgdesc="Alpine Auditor"
url="https://alpinelinux.org"
arch="noarch"
license="Unknown" # No License file or headers
depends="lua5.2 lua5.2-posix lua5.2-cjson lua5.2-pc lua5.2-socket"
subpackages="$pkgname-server"
source="aaudit-common.lua
	aaudit-server.lua
	aaudit
	aaudit-shell
	aaudit-update-keys
	aaudit-repo
	aaudit.json
	aaudit-server.json
	"
_luaver="5.2"
options="!check"

package() {
	mkdir -p "$pkgdir"/etc/aaudit \
		"$pkgdir"/usr/bin \
		"$pkgdir"/usr/share/lua/$_luaver/aaudit
	cp aaudit.json "$pkgdir"/etc/aaudit
	cp aaudit-common.lua "$pkgdir"/usr/share/lua/$_luaver/aaudit/common.lua
	cp aaudit "$pkgdir"/usr/bin
}

server() {
	depends="aaudit git lua5.2 lua5.2-posix lua5.2-cjson lua5.2-lzlib"

	mkdir -p "$subpkgdir"/etc/aaudit \
		"$subpkgdir"/usr/libexec/aaudit \
		"$subpkgdir"/usr/bin \
		"$subpkgdir"/usr/share/lua/$_luaver/aaudit
	cp aaudit-server.json "$subpkgdir"/etc/aaudit
	cp aaudit-server.lua  "$subpkgdir"/usr/share/lua/$_luaver/aaudit/server.lua
	cp aaudit-update-keys aaudit-repo "$subpkgdir"/usr/bin
	cp aaudit-shell       "$subpkgdir"/usr/libexec/aaudit
}

sha512sums="aaa378fd710d17cb3663954648e97dd5128406cc6f37e9834075046aed1912dcc9e448b6c96502350b8d3496e00b7803cae671a4be2c12c584a84dc0b6e843e9  aaudit-common.lua
023d017a03ed782ef9075c4fbabda3f5e2ea4936ef5a36f4f246e7c3ec930e1c0594b3fd7b26a7b39c0b4c815398b9d503e56cfa7d627a176bf261b4d5e0bc0b  aaudit-server.lua
f9f7f9d12bcb08571d6f071ee7557ec9ca17fbaefd27e6dc085331d84434a42df05a483b8d11b187530f146757bce4390b9bb149791d2f63254ade80cf900801  aaudit
18499771d7d425f9305209c562eb8e62ef41910e88b08219baf010cdb472d49087080feb67384c4826c53bddcc0ce92c0c23c78df22dc40c64f1b17bf0ad05ec  aaudit-shell
aec728a9a1e4c92baeb94a9d95e1785ea166652a157571fe2e848e71c1246635ecb99512e92435e1314c620b1fa8e4f37400350bed78bd375db4a63828c500f0  aaudit-update-keys
7507dea2b8ec4054e507aa3b42818863b9737402f3a9f967e16a63dd3ea12385463c2bce178a819a5f1fef76e74887a136de665e0b54172f1c1ce5f61b73403f  aaudit-repo
ca4b6defb8adcc010050bc8b1bb8f8092c4928b8a0fba32146abcfb256e4d91672f88ca2cdf6210e754e5b8ac5e23fb023806ccd749ac8b701f79a691f03c87a  aaudit.json
52da35598b8638a34d5a6352b2ccfd046dc529e0e5e6b541d3111016cbe6b091ff3fb4175e98b4f39e226ca1e6c973b9aa9a7a74fcb49b41862bbe64979d9186  aaudit-server.json"
